/*
 Navicat Premium Data Transfer

 Source Server         : LocalHost
 Source Server Type    : SQL Server
 Source Server Version : 15002000
 Source Host           : LocalHost:1433
 Source Catalog        : wiUniGUI
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 15002000
 File Encoding         : 65001

 Date: 25/03/2021 21:26:09
*/


-- ----------------------------
-- Table structure for tblStockBalance
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[tblStockBalance]') AND type IN ('U'))
	DROP TABLE [dbo].[tblStockBalance]
GO

CREATE TABLE [dbo].[tblStockBalance] (
  [fldItemCode] varchar(30) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [fldLocationCode] varchar(30) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [fldBinCode] varchar(30) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL,
  [fldLotNo] varchar(30) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL,
  [fldFromDate] datetime  NOT NULL,
  [fldToDate] datetime  NOT NULL,
  [fldOpenQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldCloseQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldGoodsReceivedQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldIQCQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldMaterialReturnQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldSalesReturnQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldAdjustmentQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldDeliveryQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldMaterialIssuedQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldPurchaseReturnQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldUselessItemQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldGoodsTransferQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldItemRequisitionQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldItemReturnQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldProductToStockQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldOutwardProcessingQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldOutwardReceivedQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldOutwardReturnQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldReservedQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldStandardCost] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldLastCost] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldAverageCost] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldPosting] bit DEFAULT 0 NOT NULL,
  [fldMonthCloseed] bit DEFAULT 0 NOT NULL
)
GO

ALTER TABLE [dbo].[tblStockBalance] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of tblStockBalance
-- ----------------------------

-- ----------------------------
-- Table structure for tblStockBalanceDay
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[tblStockBalanceDay]') AND type IN ('U'))
	DROP TABLE [dbo].[tblStockBalanceDay]
GO

CREATE TABLE [dbo].[tblStockBalanceDay] (
  [fldItemCode] varchar(30) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [fldLocationCode] varchar(30) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [fldBinCode] varchar(30) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL,
  [fldLotNo] varchar(30) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL,
  [fldDate] datetime  NOT NULL,
  [fldOpenQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldCloseQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldGoodsReceivedQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldIQCQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldMaterialReturnQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldSalesReturnQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldAdjustmentQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldDeliveryQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldMaterialIssuedQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldPurchaseReturnQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldUselessItemQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldGoodsTransferQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldItemRequisitionQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldItemReturnQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldProductToStockQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldOutwardProcessingQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldOutwardReceivedQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldOutwardReturnQty] numeric(18,6) DEFAULT 0.0 NOT NULL,
  [fldReservedQty] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldStandardCost] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldLastCost] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldAverageCost] numeric(18,6) DEFAULT 0 NOT NULL,
  [fldDayCloseed] bit DEFAULT 0 NOT NULL
)
GO

ALTER TABLE [dbo].[tblStockBalanceDay] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of tblStockBalanceDay
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table tblStockBalance
-- ----------------------------
ALTER TABLE [dbo].[tblStockBalance] ADD CONSTRAINT [PK_tblStockBalance] PRIMARY KEY CLUSTERED ([fldItemCode], [fldLocationCode], [fldBinCode], [fldLotNo], [fldFromDate], [fldToDate])
WITH (PAD_INDEX = OFF, FILLFACTOR = 90, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table tblStockBalanceDay
-- ----------------------------
ALTER TABLE [dbo].[tblStockBalanceDay] ADD CONSTRAINT [PK_tblStockBalanceDay] PRIMARY KEY CLUSTERED ([fldItemCode], [fldLocationCode], [fldBinCode], [fldLotNo], [fldDate])
WITH (PAD_INDEX = OFF, FILLFACTOR = 90, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

